home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-01-19 | 45.5 KB | 1,558 lines |
- Newsgroups: comp.sources.misc
- subject: v10i013: mp V2.3 - a PostScript pretty printer for mail etc.. (Part 1 of 2).
- from: richb@Aus.Sun.COM (Rich Burridge)
- Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
-
- Posting-number: Volume 10, Issue 13
- Submitted-by: richb@Aus.Sun.COM (Rich Burridge)
- Archive-name: mp23/part01
-
- [When things go wrong, they *really* go wrong. (Don't ask; the crash at uunet
- is a decidedly minor contributor.) Here comes a large load backed up from last
- weekend. ++bsa]
-
- Mp v2.3 - October 1989.
-
- The mp program will pretty print various files for you. It can be used
- in conjunction with a mail reading utility for producing a pretty print
- of your mail items. It can be used with a news reading tool to pretty
- print news articles. Digests can also be printed, and this version can
- pretty print ordinary ASCII files as well. Support for personal organiser
- printing was added into the last released version.
-
- It uses a PostScript prologue file which normally resides in
- /usr/local/lib, but this can be overwritten by use of the -p option.
-
- See the README file and manual pages for more details.
-
- Do a "make" followed by a "make install" which will compile the mp program
- and put the files in their default locations. You will probably have to
- be super-user when you do the "make install"
-
- I welcome further bug reports and suggestions for improvements.
-
- Rich.
-
- Rich Burridge, DOMAIN: richb@sunaus.oz.au
- PHONE: +61 2 413 2666 UUCP: {uunet,mcvax,ukc}!munnari!sunaus.oz!richb
-
- ---- Cut Here and unpack ----
- #!/bin/sh
- # shar: Shell Archiver (v1.22)
- # Packed Tue Jan 9 12:38:10 EST 1990 by stard!richb
- # from directory /extra/richb/rich_stuff/mp
- #
- # This is part 1 of a multipart archive
- # do not concatenate these parts, unpack them in order with /bin/sh
- #
- # Run the following text with /bin/sh to create:
- # README
- # Makefile
- # header.c
- # io.c
- # main.c
- # misc.c
- # print.c
- # extern.h
- # mp.h
- # patchlevel.h
- # mailp
- # mp.1
- # mp.pro.ps
- # mp.pro.filofax.ps
- # mp.pro.timeman.ps
- #
- if test -r s2_seq_.tmp
- then echo "Must unpack archives in sequence!"
- next=`cat s2_seq_.tmp`; echo "Please unpack part $next next"
- exit 1; fi
- echo "x - extracting README (Text)"
- sed 's/^X//' << 'SHAR_EOF' > README &&
- X
- XREADME for mp, the PostScript pretty printer.
- X
- XVersion 2.3 October 1989.
- X
- XPermission is given to distribute these sources, as long as the
- Xauthorship messages are not removed, and no monies are exchanged.
- X
- XThe mp program will pretty print various files for you. It can be used
- Xin conjunction with a mail reading utility for producing a pretty print
- Xof your mail items. It can be used with a news reading tool to pretty
- Xprint news articles. Digests can also be printed, and this version can
- Xpretty print ordinary ASCII files as well. Support for personal organiser
- Xprinting was added into the last released version.
- X
- XIt uses a PostScript prologue file which normally resides in
- X/usr/local/lib, but this can be overwritten by use of the -p option.
- X
- XSee the manual pages for more details on these various options.
- X
- XDo a "make" followed by a "make install" which will compile the mp program
- Xand put the files in their default locations. You will probably have to
- Xbe super-user when you do the "make install"
- X
- XAcknowledgements.
- X
- XThe original version of mp was written by Steve Holden in the ICON language,
- Xwhen Steve worked for Sun Microsystems UK. I converted it to the C language
- Xand added a few features. Bruno Pillard of Chorus Systemes, France added
- Xsupport for MH mail and news article printing, plus a shell script (mailp)
- Xwhich tidies up the user interface to mp. Dave Glowacki of Public Works
- XComputer Services, St Paul, MN. added the ability to print digests and
- Xtidied up some of the other options. Rick Rodgers, UCSF School of Pharmacy,
- XSan Francicso revised the initial version of the mp manual page. Doug
- XBuchanan added support for printing in filofax and Time Manager format.
- XMany thanks go to Jerermy Webber, Computer Science Department of the
- XUniversity of Adelaide who rewrote the message parsing and option code and
- Xmade substantial improvements to the programs user friendliness and
- Xrobustness. Sam Manogharan added support for printing multiple files
- Xspecified on the command line, and subject line filename print for ordinary
- Xfiles.
- X
- XThanks go also to Bill Shannon, Roger De Salis, L. Jill Debord, Frederick
- XAvolio, Mark Prior, Stephen Frede, Craig Bishop, Jimmy Aitken, Hugues Leroy,
- XBertrand Decouty, David Fiedler, Scott A. Jordahl, David Boone and Maureen
- XChew for bug reports and/or bug fixes.
- X
- XMy thanks also goes to Glenn Reid from Adobe Systems for the backspacefont.ps
- Xcode used in the prologue files. I'm grateful to all these people, plus
- Xeverybody who has suggested enhancements, and fixed bugs in the previous
- Xversions.
- X
- XI welcome further bug reports and suggestions for improvements.
- X
- X Rich.
- X
- XRich Burridge, DOMAIN: richb@sunaus.oz.au
- XPHONE: +61 2 413 2666 UUCP: {uunet,mcvax,ukc}!munnari!sunaus.oz!richb
- SHAR_EOF
- chmod 0444 README || echo "restore of README fails"
- set `wc -c README`;Sum=$1
- if test "$Sum" != "2752"
- then echo original size 2752, current size $Sum;fi
- echo "x - extracting Makefile (Text)"
- sed 's/^X//' << 'SHAR_EOF' > Makefile &&
- X#
- X# Makefile for mp, the PostScript pretty printer.
- X#
- X# @(#)Makefile 1.2 89/10/16
- X#
- X# Copyright (c) Steve Holden and Rich Burridge.
- X# All rights reserved.
- X#
- X# Permission is given to distribute these sources, as long as the
- X# copyright messages are not removed, and no monies are exchanged.
- X#
- X# No responsibility is taken for any errors inherent either
- X# to the comments or the code of this program, but if reported
- X# to me then an attempt will be made to fix them.
- X#
- X#=====================================================================
- X#
- X# It is possible to change the location of the mp prologue file
- X# with the -p command line option. It can also be defined at compile
- X# time, by uncommenting the macro definition below and setting
- X# appropriately. If it's not present, then a sensible default value
- X# is used.
- X#
- X#PROLOGUE = -DPROLOGUE=\"$(LIBDIR)\"
- X#=====================================================================
- X#
- X# Default locations where mp files will be installed.
- X# You might wish to alter these values.
- X#
- XBINDIR = /usr/local/bin
- XLIBDIR = /usr/local/lib
- XMANDIR = /usr/man/man$(MANSECT)
- XMANSECT = l
- X#
- X# Compilation flags and standard macro definitions.
- X#
- XCFLAGS = -g $(PROLOGUE)
- XLDFLAGS =
- X#=================================================================
- X
- X.KEEPSTATE:
- X
- XBINARIES = mp
- X
- XSRCS = header.c io.c main.c misc.c print.c
- XOBJS = $(SRCS:.c=.o)
- X
- XHDRS = extern.h mp.h patchlevel.h
- XOTHERS = README Makefile mailp mp.1 \
- X mp.pro.ps mp.pro.filofax.ps mp.pro.timeman.ps
- X
- Xall: $(BINARIES)
- X
- Xmp: $(OBJS)
- X cc $(LDFLAGS) -o mp $(OBJS)
- X
- Xinstall: $(BINARIES)
- X install -s -m 751 mp $(BINDIR)
- X install -c -m 644 mp.1 $(MANDIR)/mp.$(MANSECT)
- X install -c -m 644 mp.pro.ps $(LIBDIR)
- X install -c -m 644 mp.pro.filofax.ps $(LIBDIR)
- X install -c -m 644 mp.pro.timeman.ps $(LIBDIR)
- X
- Xclean:; rm -rf mp *.o core
- X
- Xcreate: SCCS
- X -sccs create $(SRCS) $(OTHERS)
- X
- Xlint:; lint $(SRCS)
- X
- Xshar:; shar.script $(SRCS) $(HDRS) $(OTHERS) > archive
- X
- XSCCS:
- X mkdir SCCS
- X chmod 755 SCCS
- SHAR_EOF
- chmod 0444 Makefile || echo "restore of Makefile fails"
- set `wc -c Makefile`;Sum=$1
- if test "$Sum" != "2080"
- then echo original size 2080, current size $Sum;fi
- echo "x - extracting header.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > header.c &&
- X
- X/* @(#)header.c 1.1 89/10/16
- X *
- X * Copyright (c) Steve Holden and Rich Burridge.
- X * All rights reserved.
- X *
- X * Permission is given to distribute these sources, as long as the
- X * copyright messages are not removed, and no monies are exchanged.
- X *
- X * No responsibility is taken for any errors inherent either
- X * to the comments or the code of this program, but if reported
- X * to me then an attempt will be made to fix them.
- X */
- X
- X#include "mp.h"
- X#include "extern.h"
- X
- X
- X/* If input line is header of type 'hdr', get the contents of the header
- X * into 'dest' (dynamically allocated).
- X */
- X
- Xvoid
- Xget_header(hdr, dest)
- Xchar *hdr ;
- Xchar **dest ;
- X{
- X if (EQUAL(hdr))
- X {
- X *dest = malloc((unsigned) (strlen(nextline) - strlen(hdr) + 1)) ;
- X STRCPY(*dest, nextline + strlen(hdr)) ;
- X }
- X}
- X
- X
- X/* If input line is header of type 'hdr', get header into dest. The header
- X * may have multiple lines. This skips input to next line.
- X */
- X
- Xvoid
- Xget_mult_hdr(hdr, dest)
- Xchar *hdr ;
- Xchar *dest[] ;
- X{
- X int i = 0 ;
- X
- X if (EQUAL(hdr))
- X {
- X get_header(hdr, dest) ;
- X i++ ;
- X readline() ;
- X while (i < MAXCONT && !emptyline(nextline) && isspace(nextline[0]))
- X {
- X dest[i] = malloc((unsigned) (strlen(nextline) + 1)) ;
- X STRCPY(dest[i], nextline) ;
- X i++ ;
- X readline() ;
- X }
- X dest[i] = NULL ;
- X }
- X}
- X
- X
- X/* Parse_headers is a function which reads and parses the message headers,
- X * extracting the bits which are of interest.
- X *
- X * The document is on standard input; the document is read up to the end of
- X * the header; the next line is read ahead into 'nextline'.
- X *
- X * Parameter:
- X * digest indicates if parsing is of digest headers instead of message
- X * headers
- X *
- X * Implicit Input:
- X * nextline contains the next line from standard input
- X *
- X * Side-effects:
- X * The function fills in the global header variables with headers found.
- X * The global variable doc_type is set to the document type
- X * The global variable nextline is set
- X * The document is read up to the line following the headers
- X */
- X
- X
- Xvoid
- Xparse_headers(digest)
- Xbool digest ; /* Parsing digest headers */
- X{
- X char *colon ; /* Pointer to colon in line */
- X char *c ; /* General character pointer */
- X
- X/* If not processing digest headers, determine if this article is an
- X * ordinary text file.
- X */
- X
- X if (!digest)
- X {
- X if (!EQUAL(FROM_HDR)) /* UNIX From_ header? */
- X {
- X colon = index(nextline, ':') ;
- X if (colon == NULL) /* No colon => not a header line */
- X {
- X doc_type = DO_TEXT ;
- X return ;
- X }
- X c = nextline ;
- X while (c < colon && (!isspace(*c))) c++ ;
- X if (c != colon) /* Whitespace in header name => not header */
- X {
- X doc_type = DO_TEXT ;
- X return ;
- X }
- X }
- X }
- X
- X doc_type = DO_MAIL ; /* Default to mail document */
- X
- X/* Parse headers */
- X
- X while (TRUE)
- X {
- X if (emptyline(nextline)) break ; /* End of headers */
- X
- X if (!digest)
- X {
- X get_header(FROM_HDR, &from_) ;
- X get_header(APP_FROMHDR, &apparently_from) ;
- X get_header(APP_TOHDR, &apparently_to) ;
- X get_header(NEWSGROUPSHDR, &newsgroups) ;
- X get_header(REPLYHDR, &reply_to) ;
- X
- X get_mult_hdr(TOHDR, to) ;
- X if (emptyline(nextline)) break ;
- X
- X get_mult_hdr(CCHDR, cc) ;
- X if (emptyline(nextline)) break ;
- X
- X if (doc_type != DO_NEWS && EQUAL(NEWSGROUPSHDR))
- X doc_type = DO_NEWS ;
- X }
- X get_header(FROMHDR, &from) ;
- X if (digest || *subject == '\0')
- X get_header(SUBJECTHDR, &subject) ;
- X get_header(DATEHDR, &date) ;
- X
- X if (!EQUAL(TOHDR) && !EQUAL(CCHDR))
- X {
- X while (!end_of_file && !end_of_line)
- X readline() ; /* Skip rest of long lines */
- X readline() ;
- X }
- X }
- X}
- X
- X
- Xvoid
- Xreset_headers() /* Reset header values for next message. */
- X{
- X int i ;
- X
- X if (from != NULL) free(from) ;
- X if (from_ != NULL) free(from_) ;
- X if (apparently_from != NULL) free(apparently_from) ;
- X if (apparently_to != NULL) free(apparently_to) ;
- X if (date != NULL) free(date) ;
- X if (newsgroups != NULL) free(newsgroups) ;
- X if (reply_to != NULL) free(reply_to) ;
- X
- X from = from_ = apparently_from = apparently_to = NULL ;
- X date = newsgroups = reply_to = NULL ;
- X STRCPY(subject, "") ;
- X
- X for (i = 0; i < MAXCONT+1; i++)
- X {
- X if (to[i] != NULL) free(to[i]) ;
- X if (cc[i] != NULL) free(cc[i]) ;
- X to[i] = cc[i] = NULL ;
- X }
- X}
- X
- X
- X/* Show_headers outputs the headers in PostScript. Different headers are
- X * output depending 'digest'.
- X */
- X
- Xvoid
- Xshow_headers(digest)
- Xbool digest ;
- X{
- X if (digest)
- X {
- X if (from) mixedshow(FROMHDR, from) ;
- X if (subject[0]) mixedshow(SUBJECTHDR, subject) ;
- X if (date) mixedshow(DATEHDR, date) ;
- X }
- X else
- X {
- X if (from_) boldshow(FROM_HDR, from_) ;
- X if (from) mixedshow(FROMHDR, from) ;
- X if (apparently_from) mixedshow(APP_FROMHDR, apparently_from) ;
- X if (to[0]) show_mult_hdr(TOHDR, to) ;
- X if (apparently_to) mixedshow(APP_TOHDR, apparently_to) ;
- X if (cc[0]) show_mult_hdr(CCHDR, cc) ;
- X if (reply_to) mixedshow(REPLYHDR, reply_to) ;
- X if (newsgroups) mixedshow(NEWSGROUPSHDR, newsgroups) ;
- X if (subject[0]) mixedshow(SUBJECTHDR, subject) ;
- X if (date) mixedshow(DATEHDR, date) ;
- X }
- X}
- X
- X
- Xvoid
- Xshow_mult_hdr(hdr, val)
- Xchar *hdr ; /* Name of header */
- Xchar *val[] ; /* Value of header */
- X{
- X mixedshow(hdr, *val) ;
- X val++ ;
- X while (*val) romanshow(*val++) ;
- X}
- X
- SHAR_EOF
- chmod 0444 header.c || echo "restore of header.c fails"
- set `wc -c header.c`;Sum=$1
- if test "$Sum" != "5904"
- then echo original size 5904, current size $Sum;fi
- echo "x - extracting io.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > io.c &&
- X
- X/* @(#)io.c 1.3 89/10/18
- X *
- X * Copyright (c) Steve Holden and Rich Burridge.
- X * All rights reserved.
- X *
- X * Permission is given to distribute these sources, as long as the
- X * copyright messages are not removed, and no monies are exchanged.
- X *
- X * No responsibility is taken for any errors inherent either
- X * to the comments or the code of this program, but if reported
- X * to me then an attempt will be made to fix them.
- X */
- X
- X#include "mp.h"
- X#include "extern.h"
- X
- X
- X/* Emptyline returns true if its argument is empty or whitespace only */
- X
- Xbool
- Xemptyline(str)
- Xchar *str ;
- X{
- X while (*str)
- X {
- X if (!isspace(*str)) return(FALSE) ;
- X str++ ;
- X }
- X return(TRUE) ;
- X}
- X
- X
- X/* Read an input line into nextline, setting end_of_file, end_of_page
- X * and end_of_line appropriately.
- X */
- X
- Xvoid
- Xreadline()
- X{
- X int c ;
- X int i = 0 ; /* Index into current line being read. */
- X int len = 0 ; /* Length of the current line. */
- X
- X if (end_of_file) return ;
- X end_of_page = end_of_line = FALSE ;
- X
- X while (len < llen && (c = getc(fp)) != EOF && c != '\n' && c != '\f')
- X {
- X if (c == '\t')
- X {
- X do
- X {
- X nextline[i++] = ' ' ;
- X len++ ;
- X }
- X while (len % 8 != 0 && len <= llen) ;
- X }
- X else
- X {
- X nextline[i++] = c ;
- X len++ ;
- X }
- X if (c == '\b') len -= 2 ;
- X }
- X nextline[i] = '\0' ;
- X
- X if (len == llen && c != EOF && c != '\n' && c != '\f')
- X {
- X c = getc(fp) ;
- X if (c != EOF && c != '\n' && c != '\f') UNGETC(c, fp) ;
- X }
- X
- X switch (c)
- X {
- X case EOF : if (i == 0) end_of_file = TRUE ;
- X else
- X {
- X UNGETC(c, fp) ;
- X end_of_line = TRUE ;
- X }
- X break ;
- X case '\n' : end_of_line = TRUE ;
- X break ;
- X
- X/* /usr/ucb/mail for some unknown reason, appends a bogus formfeed at
- X * the end of piped output. The next character is checked; if it's an
- X * EOF, then end_of_file is set, else the character is put back.
- X */
- X
- X case '\f' : if ((c = getc(fp)) == EOF) end_of_file = TRUE ;
- X else UNGETC(c, fp) ;
- X
- X end_of_line = TRUE ;
- X end_of_page = TRUE ;
- X break ;
- X }
- X}
- SHAR_EOF
- chmod 0444 io.c || echo "restore of io.c fails"
- set `wc -c io.c`;Sum=$1
- if test "$Sum" != "2329"
- then echo original size 2329, current size $Sum;fi
- echo "x - extracting main.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > main.c &&
- X
- X/* @(#)main.c 1.2 89/10/16
- X *
- X * Takes a mail file, a news article or an ordinary file
- X * and pretty prints it on a Postscript printer.
- X *
- X *-----------------------------------------------------------------------
- X *
- X * Credits:
- X *
- X * Original written in the Icon language by Steve Holden.
- X *
- X * Converted to C, modified and maintained
- X * by Rich Burridge - Sun Microsystems Australia.
- X *
- X * Further modifications to handle news articles and MH mail,
- X * by Bruno Pillard - Chorus Systemes, St Quentin en Yvelines, France
- X *
- X * Addition of digest printing by Dave Glowacki of Public
- X * Works Computer Services, St Paul, MN.
- X *
- X * Ordinary text file pretty printing by Rich Burridge.
- X *
- X * Substantial modifications to header parsing and command options
- X * by Jeremy Webber, Computer Science Dept, University of Adelaide,
- X * Australia.
- X *
- X * Support for printing multiple files and subject line filename print
- X * for ordinary files added by S. Manoharan, Edinburgh University.
- X *
- X *----------------------------------------------------------------------
- X *
- X * Copyright (c) Steve Holden and Rich Burridge.
- X * All rights reserved.
- X *
- X * Permission is given to distribute these sources, as long as the
- X * copyright messages are not removed, and no monies are exchanged.
- X *
- X * No responsibility is taken for any errors inherent either
- X * to the comments or the code of this program, but if reported
- X * to me then an attempt will be made to fix them.
- X */
- X
- X#include "mp.h"
- X
- X/* Command line option flags */
- X
- Xbool article = FALSE ; /* Set for news in "Article from " format. */
- Xbool digest = FALSE ; /* Are we are printing a mail digest (-d) */
- Xbool filofax = FALSE ; /* Set if we are printing a filofax file. */
- Xbool folder = FALSE ; /* Set if we are printing a mail folder. */
- Xbool text_doc = FALSE ; /* Printing normal text (-o) */
- Xbool timeman = FALSE ; /* Set if we are printing a Time Manager file. */
- X
- X/* Header definitions. */
- X
- Xchar *FROMHDR = "From:" ;
- Xchar *FROM_HDR = "From " ; /* UNIX From header */
- Xchar *APP_FROMHDR = "Apparently_from:" ;
- Xchar *TOHDR = "To:" ;
- Xchar *APP_TOHDR = "Apparently_to:" ;
- Xchar *CCHDR = "Cc:" ;
- Xchar *SUBJECTHDR = "Subject:" ;
- Xchar *DATEHDR = "Date:" ;
- Xchar *NEWSGROUPSHDR = "Newsgroups:" ;
- Xchar *REPLYHDR = "Reply_to:" ;
- X
- X/* Header lines. */
- X
- Xchar *from = NULL ; /* From: */
- Xchar *from_ = NULL ; /* From_ (UNIX from) */
- Xchar *apparently_from = NULL ; /* Apparently_from: */
- Xchar *to[MAXCONT+1] ; /* To: (can have multiple lines) */
- Xchar *apparently_to = NULL ; /* Apparently_to: */
- Xchar *cc[MAXCONT+1] = NULL ; /* Cc: (can have multiple lines) */
- Xchar *subject = "" ; /* Subject: (can be set from command line) */
- Xchar *date = NULL ; /* Date: */
- Xchar *newsgroups = NULL ; /* Newsgroups: (news articles only) */
- Xchar *reply_to = NULL ; /* Reply-to: */
- X
- X/* Strings used in page processing. */
- X
- Xchar curfname[MAXPATHLEN] ; /* Current file being printed. */
- Xchar *message_for = "" ; /* "[Mail,News,Listing] for " line */
- Xchar *nameptr ; /* Used to getenv the NAME variable. */
- Xchar *optarg ; /* Optional command line argument. */
- Xchar *owner = NULL ; /* Name of owner (usually equal to 'to') */
- Xchar *progname = "" ; /* Name of this program. */
- Xchar *prologue = PROLOGUE ; /* Name of PostScript prologue file. */
- Xchar proname[MAXPATHLEN] ; /* Full pathname of the prologue file. */
- X
- X/* Other globals. */
- X
- Xdocument_type doc_type = DO_MAIL ; /* Printing type - default mail */
- X
- Xint cmdfiles = 0 ; /* Set if file to print given on command line. */
- Xint linect = 0 ; /* Line count on current page. */
- Xint llen = LINELENGTH ; /* Number of characters per line. */
- Xint optind ; /* Optional command line argument indicator. */
- Xint pageno = 1 ; /* Page number within message. */
- Xint plen = PAGELENGTH ; /* Number of lines per page. */
- Xint tpn = 0 ; /* Total number of pages printed. */
- X
- X/* Read-ahead variables. */
- X
- Xchar nextline[MAXLINE] ; /* Read-ahead of the mail message, minus nl */
- X
- Xbool end_of_file = FALSE ; /* EOF indicator */
- Xbool end_of_line ; /* Is a newline removed from this line */
- Xbool end_of_page = FALSE ; /* end-of-page indicator - ^L on input */
- X
- XFILE *fp ; /* File pointer for current file. */
- X
- X
- Xmain(argc, argv)
- Xint argc ;
- Xchar **argv ;
- X{
- X to[0] = cc[0] = NULL ;
- X
- X progname = argv[0] ; /* Save this program name. */
- X
- X/* Try to get location of the mp prologue file from an environment variable.
- X * If it's not found, then use the default value.
- X */
- X
- X if ((prologue = getenv("MP_PROLOGUE")) == NULL)
- X prologue = PROLOGUE ;
- X SPRINTF(proname, "%s/mp.pro.ps", prologue) ;
- X
- X get_options(argc, argv) ; /* Read and process command line options. */
- X
- X if (argc - optind != 0) cmdfiles = 1 ;
- X if (!cmdfiles)
- X {
- X fp = stdin ; /* Get input from standard input. */
- X STRCPY(curfname, "stdin") ;
- X printfile() ; /* Pretty print *just* standard input. */
- X }
- X else
- X for (; optind < argc; ++optind)
- X {
- X STRCPY(curfname, argv[optind]) ; /* Current file to print. */
- X if ((fp = fopen(curfname, "r")) == NULL)
- X {
- X FPRINTF(stderr, "%s: cannot open %s\n", progname, curfname) ;
- X continue ;
- X }
- X pageno = 1 ; /* Initialise current page number. */
- X end_of_file = 0 ; /* Reset in case there's another file to print. */
- X tpn = 0 ; /* Zeroise printed page count. */
- X printfile() ; /* Pretty print current file. */
- X }
- X
- X exit(0) ;
- X}
- X
- X
- Xprintfile() /* Create PostScript to pretty print the current file. */
- X{
- X readline() ;
- X if (end_of_file)
- X {
- X FPRINTF(stderr, "mp: empty input file, nothing printed\n") ;
- X exit(1) ;
- X }
- X
- X if (!text_doc)
- X parse_headers(FALSE) ; /* Parse headers of mail or news article */
- X init_setup() ; /* Set values for remaining globals. */
- X show_prologue(proname) ; /* Send prologue file to output */
- X set_defs() ; /* Output initial definitions. */
- X
- X fputs("%%EndProlog\n", stdout) ;
- X
- X/* Print the document */
- X
- X startpage() ;
- X if (doc_type != DO_TEXT) show_headers(FALSE) ;
- X while (!end_of_file)
- X {
- X if (folder && EQUAL(FROM_HDR))
- X {
- X linect = plen ;
- X reset_headers() ;
- X parse_headers(FALSE) ;
- X show_headers(FALSE) ;
- X }
- X if (digest && (EQUAL(FROMHDR) || EQUAL(DATEHDR) || EQUAL(SUBJECTHDR)))
- X {
- X linect = plen ;
- X parse_headers(TRUE) ;
- X show_headers(TRUE) ;
- X }
- X textshow(nextline) ;
- X readline() ;
- X }
- X if (filofax || timeman) endfile() ;
- X else endpage() ;
- X FCLOSE(fp) ;
- X fputs("%%Trailer\n", stdout) ;
- X PRINTF("%%%%Pages: %1d\n", tpn) ;
- X}
- SHAR_EOF
- chmod 0444 main.c || echo "restore of main.c fails"
- set `wc -c main.c`;Sum=$1
- if test "$Sum" != "7091"
- then echo original size 7091, current size $Sum;fi
- echo "x - extracting misc.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > misc.c &&
- X
- X/* @(#)misc.c 1.2 89/10/16
- X *
- X * Copyright (c) Steve Holden and Rich Burridge.
- X * All rights reserved.
- X *
- X * Permission is given to distribute these sources, as long as the
- X * copyright messages are not removed, and no monies are exchanged.
- X *
- X * No responsibility is taken for any errors inherent either
- X * to the comments or the code of this program, but if reported
- X * to me then an attempt will be made to fix them.
- X */
- X
- X#include "mp.h"
- X#include "patchlevel.h"
- X#include "extern.h"
- X
- X
- Xvoid
- Xdo_date() /* Output Postscript definition for the date and time. */
- X{
- X long clock ; /* Used by the localtime function call. */
- X struct tm *tm ; /* Used by the localtime and asctime calls. */
- X
- X if (date == NULL)
- X {
- X clock = time((time_t *) 0) ;
- X tm = localtime(&clock) ;
- X psdef("TimeNow", asctime(tm)) ;
- X }
- X else psdef("TimeNow", date) ;
- X}
- X
- X
- Xget_opt(argc, argv, options)
- Xint argc ;
- Xchar **argv, *options ;
- X{
- X char opch, *str, *ptr ;
- X static int flag = 0 ;
- X static int cur_argc ;
- X static char **cur_argv ;
- X
- X if (flag == 0)
- X {
- X cur_argc = argc ;
- X cur_argv = argv ;
- X flag = 1 ;
- X optind = 1 ;
- X }
- X
- X if (cur_argc <= 1) return -1 ;
- X
- X if (--cur_argc >= 1)
- X {
- X str = *++cur_argv ;
- X if (*str != '-') return -1 ; /* Argument is not an option */
- X else
- X { /* Argument is an option */
- X if ((ptr = strchr(options, opch = *++str)) != (char *) 0)
- X {
- X ++optind ;
- X optarg = ++str ; /* Point to rest of argument if any */
- X if ((*++ptr == ':') && (*optarg == '\0'))
- X {
- X if (--cur_argc <= 0) return '?' ;
- X optarg = *++cur_argv ;
- X ++optind ;
- X }
- X return opch ;
- X }
- X else if (opch == '-')
- X { /* End of options */
- X ++optind ;
- X return -1 ;
- X }
- X else return '?' ;
- X }
- X }
- X return 0 ; /* Should never be reached. */
- X}
- X
- X
- Xget_options(argc, argv) /* Read and process command line options. */
- Xint argc ;
- Xchar *argv[] ;
- X{
- X int opch ;
- X
- X while ((opch = get_opt(argc, argv, "adfmop:s:tv")) != -1)
- X switch (opch)
- X {
- X case 'a' : article = TRUE ; /* "Article from" format. */
- X break ;
- X case 'd' : digest = TRUE ; /* Print digest. */
- X break ;
- X case 'f' : filofax = TRUE ; /* Print filofax file. */
- X SPRINTF(proname, "%s/mp.pro.filofax.ps", prologue) ;
- X break ;
- X case 'm' : folder = TRUE ; /* Print mail folder. */
- X break ;
- X case 'o' : text_doc = TRUE ; /* Print ordinary text file */
- X break ;
- X case 'p' : if (strlen(optarg))
- X STRCPY(proname, optarg) ; /* New prologue file. */
- X break ;
- X case 's' : if (strlen(optarg))
- X subject = optarg ; /* New subject line. */
- X break ;
- X case 't' : timeman = TRUE ; /* Print Time Manager file. */
- X SPRINTF(proname, "%s/mp.pro.timeman.ps", prologue) ;
- X break ;
- X case 'v' : FPRINTF(stderr,
- X "%s version 2.3.%1d\n", progname, PATCHLEVEL) ; exit(1) ;
- X case '?' : usage() ;
- X }
- X}
- X
- X
- Xvoid
- Xinit_setup() /* Set default values for various options. */
- X{
- X char *c, *ptr ;
- X int amp_cnt = 0 ; /* Number of ampersands in gecos field. */
- X int i, j, n, spaces ;
- X struct passwd *pp ;
- X
- X c = getlogin() ; /* Pointer to users login name. */
- X if (c == NULL) /* Get username from password file */
- X {
- X pp = getpwuid(geteuid()) ;
- X if (pp == NULL) c = "printing" ;
- X else c = pp->pw_name ;
- X }
- X owner = malloc((unsigned) (strlen(c) + 1)) ;
- X STRCPY(owner, c) ;
- X
- X/* Have a look for the users gecos (normally real name), so that its a bit
- X * more recognisable. If this field is too long, then we need to truncate
- X * sensibly. We also need to check a few things. If we've extracted
- X * two "words" or have found a comma, then exit. If an ampersand is
- X * found, this is expanded to the users name in capitals.
- X */
- X
- X pp = getpwnam(owner) ;
- X if (pp != NULL && pp->pw_gecos && pp->pw_gecos[0] != '\0')
- X {
- X for (i = 0; i < strlen(pp->pw_gecos); i++)
- X if (pp->pw_gecos[i] == '&') amp_cnt++ ;
- X
- X owner = malloc((unsigned) (strlen(pp->pw_gecos) +
- X amp_cnt * strlen(c) + 1)) ;
- X
- X n = spaces = 0 ;
- X ptr = pp->pw_gecos ;
- X for (i = 0; i < strlen(pp->pw_gecos); i++)
- X {
- X if (*ptr == ',') break ;
- X else if (*ptr == '&')
- X {
- X for (j = 0; j < strlen(c); j++)
- X if (islower(c[j])) owner[n++] = toupper(c[j]) ;
- X else owner[n++] = c[j] ;
- X *ptr++ ;
- X }
- X else if (*ptr == ' ')
- X {
- X if (++spaces == 2) break ;
- X else owner[n++] = *ptr++ ;
- X }
- X else owner[n++] = *ptr++ ;
- X if (n >= NAMELENGTH) break ;
- X }
- X if (n > NAMELENGTH) n = NAMELENGTH ;
- X owner[n] = '\0' ;
- X }
- X if ((nameptr = getenv("NAME")) != NULL)
- X STRCPY(owner, nameptr) ;
- X
- X if (text_doc) doc_type = DO_TEXT ;
- X switch (doc_type)
- X {
- X case DO_TEXT : message_for = "Listing for ";
- X digest = FALSE ;
- X break ;
- X case DO_MAIL : message_for = digest ? "Mail digest for " : "Mail for " ;
- X break ;
- X case DO_NEWS : message_for = digest ? "News digest for " : "News for " ;
- X break ;
- X }
- X}
- X
- X
- Xusage() /* Print usage message and exit. */
- X{
- X FPRINTF(stderr,"Usage: %s [-a] [-d] [-f] [-m] ", progname) ;
- X FPRINTF(stderr, "[-o] [-p prologue] [-s subject] [-t] [-v] [-?]\n") ;
- X exit(1) ;
- X}
- X
- SHAR_EOF
- chmod 0444 misc.c || echo "restore of misc.c fails"
- set `wc -c misc.c`;Sum=$1
- if test "$Sum" != "6066"
- then echo original size 6066, current size $Sum;fi
- echo "x - extracting print.c (Text)"
- sed 's/^X//' << 'SHAR_EOF' > print.c &&
- X
- X/* @(#)print.c 1.2 89/10/16
- X *
- X * Copyright (c) Steve Holden and Rich Burridge.
- X * All rights reserved.
- X *
- X * Permission is given to distribute these sources, as long as the
- X * copyright messages are not removed, and no monies are exchanged.
- X *
- X * No responsibility is taken for any errors inherent either
- X * to the comments or the code of this program, but if reported
- X * to me then an attempt will be made to fix them.
- X */
- X
- X#include "mp.h"
- X#include "extern.h"
- X
- X
- Xboldshow(hdr, str) /* Display a header all in bold. */
- Xchar *hdr, *str ;
- X{
- X useline() ;
- X fputs("BoldFont ", stdout) ;
- X startline() ;
- X expand(hdr) ;
- X expand(str) ;
- X endline() ;
- X}
- X
- X
- Xendfile()
- X{
- X linect = 0 ;
- X PRINTF("(%1d) endfile\n", pageno) ;
- X}
- X
- X
- Xendline()
- X{
- X PRINTF(") showline\n") ;
- X}
- X
- X
- Xendpage()
- X{
- X linect = 0 ;
- X PRINTF("(%1d) endpage\n", pageno++) ;
- X}
- X
- X
- Xexpand(s) /* Display a string with PostScript-sensitive characters escaped */
- Xchar *s ;
- X{
- X for (; *s; s++)
- X {
- X switch (*s)
- X {
- X case '\\' : fputs("\\\\", stdout) ;
- X break ;
- X case '(' : fputs("\\(", stdout) ;
- X break ;
- X case ')' : fputs("\\)", stdout) ;
- X break ;
- X case '\b' : PUTC(*s, stdout) ;
- X break ;
- X default : if (isprint(*s)) PUTC(*s, stdout) ;
- X }
- X }
- X}
- X
- X
- Xmixedshow(hdr, str) /* Display a header in mixed bold/Roman. */
- Xchar *hdr, *str ;
- X{
- X useline() ;
- X fputs("BoldFont ", stdout) ;
- X startline() ;
- X expand(hdr) ;
- X fputs(") show PrimaryFont (", stdout) ;
- X expand(str) ;
- X endline() ;
- X}
- X
- X
- Xpsdef(name, def) /* Do a PostScript define. */
- Xchar *name, *def ;
- X{
- X PRINTF("/%s (", name) ;
- X expand(def) ;
- X PRINTF(") def\n") ;
- X}
- X
- X
- Xromanshow(str) /* Display a header all in Roman. */
- Xchar *str ;
- X{
- X useline() ;
- X fputs("PrimaryFont ", stdout) ;
- X startline() ;
- X expand(str) ;
- X endline() ;
- X}
- X
- X
- Xvoid
- Xset_defs() /* Setup PostScript definitions. */
- X{
- X int i ;
- X
- X if (article == TRUE)
- X STRCPY(message_for, "Article from") ; /* MailFor. */
- X psdef("MailFor", message_for) ;
- X
- X if (article == TRUE && newsgroups != NULL) /* User. */
- X {
- X for (i = 0; i < strlen(newsgroups); i++)
- X if (newsgroups[i] == ',' ||
- X newsgroups[i] == '\0') break ;
- X STRNCPY(owner, newsgroups, i) ;
- X owner[i] = '\0' ;
- X }
- X psdef("User", owner) ;
- X
- X do_date() ; /* TimeNow. */
- X
- X if (text_doc && cmdfiles) STRCPY(subject, curfname) ;
- X psdef("Subject", subject) ; /* Subject. */
- X}
- X
- X
- X/* Display the PostScript prologue file for mp */
- X
- Xshow_prologue(pro)
- Xchar *pro ; /* Prologue file name */
- X{
- X FILE *pf ;
- X char buf[MAXLINE], tmpstr[MAXLINE] ;
- X int t2 ; /* Possible extract page or line length. */
- X
- X if ((pf = fopen(pro, "r")) == NULL)
- X {
- X FPRINTF(stderr,"%s: Prologue file %s not found.\n",progname, pro) ;
- X exit(1) ;
- X }
- X while (fgets(buf, MAXLINE, pf) != NULL)
- X {
- X fputs(buf, stdout) ;
- X
- X/* Check for new line or page length. */
- X
- X SSCANF(buf, "%s %d", tmpstr, &t2) ;
- X if (strcmp(tmpstr, "%%PageLength") == 0)
- X plen = t2 ; /* Change the page length. */
- X else if (strcmp(tmpstr, "%%LineLength") == 0)
- X llen = t2 ; /* Change the line length. */
- X }
- X FCLOSE(pf) ;
- X}
- X
- X
- Xstartline()
- X{
- X PRINTF("(") ;
- X}
- X
- X
- Xstartpage()
- X{
- X PRINTF("%%%%Page: ? %1d\n", ++tpn) ;
- X psdef("MailFor", message_for) ;
- X psdef("User", owner) ;
- X}
- X
- X
- Xtextshow(s)
- Xchar *s ;
- X{
- X useline() ;
- X fputs("SecondaryFont ", stdout) ;
- X startline() ;
- X expand(s) ;
- X endline() ;
- X}
- X
- X
- Xuseline() /* Called in order to ready a line for printing. */
- X{
- X if (++linect > plen || end_of_page == TRUE)
- X {
- X endpage() ;
- X linect = 0 ;
- X startpage() ;
- X psdef("Subject", subject) ;
- X do_date() ;
- X }
- X}
- SHAR_EOF
- chmod 0444 print.c || echo "restore of print.c fails"
- set `wc -c print.c`;Sum=$1
- if test "$Sum" != "3992"
- then echo original size 3992, current size $Sum;fi
- echo "x - extracting extern.h (Text)"
- sed 's/^X//' << 'SHAR_EOF' > extern.h &&
- X
- X/* @(#)extern.h 1.1 89/10/16
- X *
- X * Contains all the external definitions used by mp.
- X *
- X * Copyright (c) Steve Holden and Rich Burridge.
- X * All rights reserved.
- X *
- X * Permission is given to distribute these sources, as long as the
- X * copyright messages are not removed, and no monies are exchanged.
- X *
- X * No responsibility is taken for any errors or inaccuracies inherent
- X * either to the comments or the code of this program, but if
- X * reported to me then an attempt will be made to fix them.
- X */
- X
- Xextern char *APP_FROMHDR ;
- Xextern char *APP_TOHDR ;
- Xextern char *CCHDR ;
- Xextern char *DATEHDR ;
- Xextern char *FROMHDR ;
- Xextern char *FROM_HDR ; /* UNIX From header */
- Xextern char *NEWSGROUPSHDR ;
- Xextern char *REPLYHDR ;
- Xextern char *SUBJECTHDR ;
- Xextern char *TOHDR ;
- X
- Xextern char *apparently_from ; /* Apparently_from: */
- Xextern char *apparently_to ; /* Apparently_to: */
- Xextern char *cc[] ; /* Cc: (can have multiple lines) */
- Xextern char *date ; /* Date: */
- Xextern char *from ; /* From: */
- Xextern char *from_ ; /* From_ (UNIX from) */
- Xextern char *newsgroups ; /* Newsgroups: (news articles only) */
- Xextern char *reply_to ; /* Reply-to: */
- Xextern char *subject ; /* Subject: (can be set from command line) */
- Xextern char *to[] ; /* To: (can have multiple lines) */
- X
- Xextern char curfname[] ; /* Current file being printed. */
- Xextern char *message_for ; /* "[Mail,News,Listing] for " line */
- Xextern char *nameptr ; /* Used to getenv the NAME variable. */
- Xextern char nextline[] ; /* Read-ahead of the mail message, minus nl */
- Xextern char *optarg ; /* Optional command line argument. */
- Xextern char *owner ; /* Name of owner (usually equal to 'to') */
- Xextern char *progname ; /* Name of this program. */
- Xextern char *prologue ; /* Name of PostScript prologue file. */
- Xextern char proname[] ; /* Full pathname of the prologue file. */
- X
- Xextern int cmdfiles ; /* Set if file to print given on command line. */
- Xextern int linect ; /* Line count on current page. */
- Xextern int llen ; /* Number of characters per line. */
- Xextern int optind ; /* Optional command line argument indicator. */
- Xextern int pageno ; /* Page number within message. */
- Xextern int plen ; /* Number of lines per page. */
- Xextern int tpn ; /* Total number of pages printed. */
- X
- Xextern bool article ; /* Set for news in "Article from " format. */
- Xextern bool digest ; /* Are we are printing a mail digest (-d) */
- Xextern bool filofax ; /* Set if we are printing a filofax file. */
- Xextern bool folder ; /* Set if we are printing a mail folder. */
- Xextern bool text_doc ; /* Printing normal text (-o) */
- Xextern bool timeman ; /* Set if we are printing a Time Manager file. */
- X
- Xextern bool end_of_file ; /* EOF indicator */
- Xextern bool end_of_line ; /* Is a newline removed from this line */
- Xextern bool end_of_page ; /* end-of-page indicator - ^L on input */
- X
- Xextern document_type doc_type ; /* Printing type - default mail */
- X
- Xextern FILE *fp ; /* File pointer for current file. */
- SHAR_EOF
- chmod 0444 extern.h || echo "restore of extern.h fails"
- set `wc -c extern.h`;Sum=$1
- if test "$Sum" != "3248"
- then echo original size 3248, current size $Sum;fi
- echo "x - extracting mp.h (Text)"
- sed 's/^X//' << 'SHAR_EOF' > mp.h &&
- X
- X/* @(#)mp.h 1.1 89/10/16
- X *
- X * Contains all the global definitions used by mp.
- X *
- X * Copyright (c) Steve Holden and Rich Burridge.
- X * All rights reserved.
- X *
- X * Permission is given to distribute these sources, as long as the
- X * copyright messages are not removed, and no monies are exchanged.
- X *
- X * No responsibility is taken for any errors or inaccuracies inherent
- X * either to the comments or the code of this program, but if
- X * reported to me then an attempt will be made to fix them.
- X */
- X
- X#include <stdio.h>
- X#include <sys/types.h>
- X#include <sys/file.h>
- X#include <sys/param.h>
- X#include <ctype.h>
- X#include <time.h>
- X#include <pwd.h>
- X
- X#define FCLOSE (void) fclose
- X#define FPRINTF (void) fprintf
- X#define PRINTF (void) printf
- X#define PUTC (void) putc
- X#define SPRINTF (void) sprintf
- X#define SSCANF (void) sscanf
- X#define STRCPY (void) strcpy
- X#define STRNCPY (void) strncpy
- X#define UNGETC (void) ungetc
- X
- X/* Configuration constants */
- X
- X#ifndef PROLOGUE /* PostScript prologue file */
- X#define PROLOGUE "/usr/local/lib"
- X#endif PROLOGUE
- X
- X#define EQUAL(val) (!strncmp(val, nextline, strlen(val)))
- X#define INC argc-- ; argv++ ;
- X#define LINELENGTH 80 /* Number of characters per line. */
- X#define NAMELENGTH 18 /* Maximum allowable real user name. */
- X#define PAGELENGTH 60 /* Number of lines per page. */
- X#define MAXCONT 10 /* Maximum no of continuation header lines */
- X#define MAXLINE 256 /* Maximum string length. */
- X
- X#ifndef TRUE
- X#define TRUE 1
- X#define FALSE 0
- X#endif /*TRUE*/
- X
- Xtypedef enum {DO_MAIL, DO_NEWS, DO_TEXT} document_type ;
- Xtypedef char bool ;
- X
- Xtime_t time() ;
- Xstruct tm *localtime() ;
- Xbool emptyline() ;
- XFILE *fopen() ;
- Xchar *asctime(), *getenv(), *getlogin(), *gets(), *index(), *malloc() ;
- Xchar *sprintf(), *strchr(), *strcpy(), *strncpy() ;
- X
- Xvoid do_date(), get_header(), get_mult_hdr(), init_setup() ;
- Xvoid parse_headers(), readline(), reset_headers(), set_defs() ;
- Xvoid show_headers(), show_mult_hdr() ;
- SHAR_EOF
- chmod 0444 mp.h || echo "restore of mp.h fails"
- set `wc -c mp.h`;Sum=$1
- if test "$Sum" != "2089"
- then echo original size 2089, current size $Sum;fi
- echo "x - extracting patchlevel.h (Text)"
- sed 's/^X//' << 'SHAR_EOF' > patchlevel.h &&
- X
- X/* @(#)patchlevel.h 1.2 89/10/18
- X *
- X * This is the current patch level for this version of mp.
- X *
- X * Copyright (c) Steve Holden and Rich Burridge.
- X * All rights reserved.
- X *
- X * Permission is given to distribute these sources, as long as the
- X * copyright messages are not removed, and no monies are exchanged.
- X *
- X * No responsibility is taken for any errors or inaccuracies inherent
- X * either to the comments or the code of this program, but if
- X * reported to me then an attempt will be made to fix them.
- X */
- X
- X#define PATCHLEVEL 1
- SHAR_EOF
- chmod 0444 patchlevel.h || echo "restore of patchlevel.h fails"
- set `wc -c patchlevel.h`;Sum=$1
- if test "$Sum" != "557"
- then echo original size 557, current size $Sum;fi
- echo "x - extracting mailp (Text)"
- sed 's/^X//' << 'SHAR_EOF' > mailp &&
- X#! /bin/sh
- X#
- X# @(#)mailp 1.5 89/06/28
- X#
- X# mailp, newsp, filep, digestp, filofaxp and timemanp
- X# shell script de lancement de mp
- X# (mail/news/file/digest/filofax/time-manager pretty printer)
- X#
- X# Original: Bruno Pillard - October 1988.
- X# Modified: Rich Burridge - June 1989.
- X
- XBIN=/usr/local/bin
- X
- Xcase $0 in
- X *mailp) PROG=mp ;;
- X *newsp) PROG=mp ;;
- X *digestp) PROG="mp -d" ;;
- X *filep) PROG="mp -o" ;;
- X *filofaxp) PROG="mp -f ;;
- X *timemanp) PROG="mp -t ;;
- X *) echo Unknown pretty printer: $0
- X exit;;
- Xesac
- X
- Xif [ $# -eq 0 ]
- Xthen
- X set - " - "
- Xfi
- Xwhile [ $# -gt 0 ]
- Xdo
- X /bin/cat $1 | ${BIN}/${PROG} | lpr -h -Plw
- X shift
- Xdone
- SHAR_EOF
- chmod 0444 mailp || echo "restore of mailp fails"
- set `wc -c mailp`;Sum=$1
- if test "$Sum" != "655"
- then echo original size 655, current size $Sum;fi
- echo "x - extracting mp.1 (Text)"
- sed 's/^X//' << 'SHAR_EOF' > mp.1 &&
- X.\" @(#)mp.1 1.11 89/10/18
- X.TH MP 1L "17 October 1989"
- X.SH NAME
- Xmp \- Postscript pretty printer
- X.SH SYNOPSIS
- X.B mp
- X[
- X.B \-a
- X]
- X[
- X.B \-d
- X]
- X[
- X.B \-f
- X]
- X[
- X.B \-m
- X]
- X[
- X.B \-o
- X]
- X[
- X.B \-p
- X.I prologue
- X]
- X[
- X.B \-s
- X.I subject
- X]
- X[
- X.B \-t
- X]
- X[
- X.B \-v
- X]
- X[
- X.B \-?
- X]
- X[
- X.IR filename .\|.\|.
- X]
- X.SH DESCRIPTION
- X.B mp
- Xwill read each
- X.I filename
- Xin sequence and generate a Postscript file on standard output,
- Xwhich is a pretty print of the original. If no filename argument is given
- X.B mp
- Xreads from the standard input. If the standard input is a terminal, input
- Xis terminated by an
- X.SM EOF
- Xsignal, usually
- X.SM CTRL-D\s0.
- X.LP
- XThe input files to
- X.B mp
- Xcan be mail items, news articles or ordinary ASCII files. It is also
- Xpossible to print out complete mail folders and digests.
- X.LP
- XThe format adopted has textured areas containing banner information
- Xat the top and bottom of every page.
- X.LP
- X.B mp
- Xwas originally designed to be used in conjunction with the print
- Xbutton in the
- X.B "mailtool (1)"
- Xprogram, or the
- X.B pipe
- Xcommand from within mail. Add (or alter) the following two line in your
- X.B .mailrc
- Xfile:
- X.in +1.0i
- X.nf
- X\fCset printmail='mp | lpr'
- Xset cmd="mp | lpr &"\fP
- X.fi
- X.in -1.0i
- X.LP
- XSource the
- X.B .mailrc
- Xfile again, and you are ready.
- X.LP
- XA useful alias to use used in conjunction with your
- X.I .cshrc
- Xfile for printing out ordinary text files is:
- X.in +1.0i
- X.nf
- X\fCalias print 'mp -o -s "\\!*" <\\!* | lpr'\fP
- X.fi
- X.in -1.0i
- X.SH OPTIONS
- X.TP
- X.B \-a
- XThe file on standard input is a news article, and should be printed with
- X"Article from
- X.I newsgroup
- X" in the top banner, where
- X.I newsgroup
- Xis the first news group found on the Newsgroups: line.
- X.TP
- X.B \-d
- XThe file on standard input is a digest so print accordingly.
- X.TP
- X.B \-f
- XThe file on standard input is printed specifically was use with Filofax,
- Xa personal organiser.
- X.TP
- X.B \-m
- XThe file on standard input is a mail folder, so print out multiple messages.
- X.TP
- X.B \-o
- XThe file on standard input is an ASCII file so print accordingly.
- X.TP
- X.BI \-p " prologue filename"
- XEmploy
- X.I "prologue filename"
- Xas the Postscript prologue file. This overrides any previously defined
- Xprologue values.
- XThe
- X.I mp
- Xprologue file is determined by first looking for the environment variable
- X.IR MP_PROLOGUE .
- XThis will be the directory where the mp prologue files are to be found.
- XThree different prologue files are used. Normally the prologue file is
- X.I mp.pro.ps
- Xbut if the
- X-I \-f
- Xoption is used, then the prologue file is called
- X-I mp.pro.filofax.ps
- Xand if the
- X-I \-t
- Xoption is used, then the prologue file is
- X-I mp.pro.timeman.ps
- XIf
- X.I MP_PROLOGUE
- Xisn't found, then the default location is used. The default location is
- X.IR /usr/local/lib/mp.pro.ps .
- X.TP
- X.BI \-s " subject"
- XUse
- X.I " subject"
- Xas the new subject for the printout. If you are printing ordinary text
- Xfiles which have been specified on the command line, the the subject will
- Xdefault to the name of each of these files.
- X.TP
- X.B \-t
- XThe file on standard input is printed specifically for use with Time Manager,
- Xa personal organiser.
- X.TP
- X.B \-v
- XPrint the version number of this release of the
- X.B mp
- Xprogram.
- X.TP
- X.B \-?
- XPrint the usage line for this program. Note that the
- X.B ?
- Xcharacter should be escaped if running from
- X.BR csh (1).
- X.SH FILES
- X.TP
- X.B /usr/local/bin/mp
- Xexecutable
- X.TP
- X.B /usr/local/lib/mp.pro.ps
- XPostScript prologue to define required vocabulary for mail printing.
- SHAR_EOF
- echo "End of part 1"
- echo "File mp.1 is continued in part 2"
- echo "2" > s2_seq_.tmp
- exit 0
-
-